﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;

public partial class setImage : System.Web.UI.Page
{
    string logo = "default.jpeg";
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        logo = "default.jpeg";
    }
    protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
    {
        logo = "default1.png";
    }

    protected void Button2_Click(object sender, EventArgs e)
    {
        if (File1.PostedFile != null)
        {
            try
            {
                
                //File1.PostedFile.SaveAs("C:\\Uploads\\uploadedfile.txt");
                string filepath = File1.PostedFile.FileName;
               

                 string fileimage = System.IO.Path.GetFullPath(File1.PostedFile.FileName);
                //save the file to the server 
                Image1.ImageUrl = filepath;
                File1.PostedFile.SaveAs(Server.MapPath(".//data/logos//"+filepath) );
                Span1.InnerHtml = "Upload Successful!";
            }
            catch (Exception ex)
            {
                Span1.InnerHtml = "Error saving file <b>"+File1.PostedFile.FileName;
                  
            }
        }
    }   
}
